<extend name="Index/index"/>		
<block name="main">
		
		<link href="__PUBLIC__/static/css/cartstyle.css" rel="stylesheet" type="text/css" />

		<link href="__PUBLIC__/static/css/jsstyle.css" rel="stylesheet" type="text/css" />

		<script type="text/javascript" src="__PUBLIC__/static/js/address.js"></script>

	</head>

<body>
	<!--顶部导航条 -->
	<include file="Public/top" />
		<div class="concent">
			<form action="<{:U('Order/make')}>" method="post" name="theForm" id="theForm">
			<div class="theme-popover">

				<!--标题 -->
				<div class="am-cf am-padding">
					<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">新增地址</strong> / <small>Add address</small></div>
				</div>
				<hr/>

				<div class="am-u-md-12">
					<div class="am-form am-form-horizontal">

						<div class="am-form-group">
							<label for="user-name" class="am-form-label">收货人</label>
							<div class="am-form-content">
								<input type="text" id="user-name" placeholder="收货人" name="receiver">
							</div>
						</div>

						<div class="am-form-group">
							<label for="user-phone" class="am-form-label">手机号码</label>
							<div class="am-form-content">
								<input name="tel" id="user-phone" placeholder="手机号必填" type="text" maxlength="11">
							</div>
						</div>

						<div class="am-form-group">
							<label for="user-phone" class="am-form-label">所在地</label>
							<div class="am-form-content address">
								<select id="pro" name="pro"></select>
								<select id="city" name="city"></select>
								<select id="area" name="area"></select>
								<select id="street" name="street"></select>
							</div>
						</div>

						<div class="am-form-group">
							<label for="user-intro" class="am-form-label">详细地址</label>
							<div class="am-form-content">
								<textarea class="" rows="3" id="user-intro" placeholder="输入详细地址" name="address"></textarea>
								<small>100字以内写出你的详细地址...</small>
							</div>
						</div>

						
					</div>
				</div>
			</div>
			
					

			<!--支付方式-->
			<div class="logistics">
				<h3>选择支付方式</h3>
				<ul class="pay-list">
					<li class="pay card"><label><input type="radio" name='paytype' value='1' checked="checked">在线支付</label></li>
					<li class="pay qq"><label><input type="radio" name='paytype' value='2'>货到付款</label></li>
				</ul>
			</div>
			<div class="clear"></div>
			
				<!--订单 -->
				

				
					<div id="payTable">
						<h3>确认订单信息</h3>
						<div class="cart-table-th">
							<div class="wp">
								<div class="th th-item">
									<div class="td-inner">商品信息</div>
								</div>
								<div class="th th-price">
									<div class="td-inner">单价</div>
								</div>
								<div class="th th-amount">
									<div class="td-inner">数量</div>
								</div>
								<div class="th th-sum">
									<div class="td-inner">金额</div>
								</div>
								<div class="th th-oplist">
									<div class="td-inner">配送方式</div>
								</div>
							</div>
						</div>
						<div class="clear"></div>



						<foreach name="_SESSION['Mycar']" item="v" key="k">

						<tr class="item-list">
							<div class="bundle  bundle-last">

								<div class="bundle-main">
									<ul class="item-content clearfix">
										<div class="pay-phone">
											<li class="td td-item">
												<div class="item-pic">
													<a href="#" class="J_MakePoint">
														<img src="__UPLOAD__/<{$v['img']}>" class="itempic J_ItemImg" width="80"></a>
												</div>
												<div class="item-info">
													<div class="item-basic-info">
														<a href="#" class="item-title J_MakePoint" data-point="tbcart.8.11"><{$v['gname']}></a>
													</div>
												</div>
											</li>
											<li class="td td-info">
												<div class="item-props">
													<span class="sku-line">颜色：12#川南玛瑙</span>
													<span class="sku-line"><{$v['des']}></span>
												</div>
											</li>
											<li class="td td-price">
												<div class="item-price price-promo-promo">
													<div class="price-content">
														<em class="J_Price price-now price"><{$v['price']}></em>
													</div>
												</div>
											</li>
										</div>
										<li class="td td-amount">
											<div class="amount-wrapper ">
												<div class="item-amount ">
													<span class="phone-title">购买数量</span>
													<div class="sl">
														<em class="J_Price price-now num"><{$v['num']}></em>
													</div>
												</div>
											</div>
										</li>
										<li class="td td-sum">
											<div class="td-inner">
												<em tabindex="0" class="J_ItemSum number"><{$v['num']*$v['price']}></em>
											</div>
										</li>
										<li class="td td-oplist">
											<div class="td-inner">
												<span class="phone-title">配送方式</span>
												<div class="pay-logis">
													快递<b class="sys_item_freprice">10</b>元
												</div>
											</div>
										</li>

									</ul>
									<div class="clear"></div>

								</div>
							</tr>
							<div class="clear"></div>
						</foreach>
						

						
					</div>

					<div class="clear"></div>
					<div class="pay-total">
						
						<!--信息 -->
						<div class="order-go clearfix">
							<div class="pay-confirm clearfix">
								<div class="box">
									<div tabindex="0" id="holyshit267" class="realPay">
										<empty name="ccc">
										
										<else />
										<em class="t">满足:满<{$ccc['one']}>减<{$ccc['two']}>条件</em>
										<p>原价：<{$tprice['old']}>¥</p>
										<p>优惠：<{$ccc['two']}>¥</p>
										</empty>
										<em class="t">实付款：</em>
										<span class="price g_price ">
                                		<span>¥</span> <em class="style-large-bold-red " id="J_ActualFee"><{$tprice['now']?$tprice['now']:0}></em>
										</span>
									</div>		
								</div>
								<div class="clear"></div>
							</div>
						</div>
					</div>

					<div class="clear"></div>
					<div id="holyshit269" class="submitOrder">
									<div class="go-btn-wrap">
										<input type="submit" class="btn-go" value="提交订单">
										<!-- <a id="J_Go" href="success.html" class="btn-go" tabindex="0" title="点击此按钮，提交订单">提交订单</a> -->
									</div>
								</div>
					</form>
				</div>
			</div>
		</div>
		<a href="<{:U('Order/four')}>" class="url"></a>
		<div class="clear"></div>
		<script>
		$(function(){
			url = $('.url').attr('href');
			console.log(url);

			$.ajax({
				type:'get',
				url:url,
				success:function(data){
					console.log(data);
					//先清空原先的数据
					//遍历省份数据
					for(var i = 0; i<data.length;i++){
						$('<option value="'+data[i].id+'">'+data[i].name+'</option>').appendTo('#pro');
					}
				},
				dataType:'json',
				async:false,//同步!!!!!!!!!
			})

			//绑定事件
			$('#pro,#city,#area').change(function(){
				//获取当前的vale值
				var upid = $(this).val();
				// console.log(upid);
				//一触发change事件，就清空后面所有的数据
				$(this).nextAll('select').show().empty();
				//保留$(this)变量
				var _this = $(this);
				// console.log($(this));

				//请求下一级数据
				$.ajax({
					type:'get',
					url:url,
					data:"upid="+upid,
					success:function(data){
						//如果没有数据，就隐藏后面的下拉框
						if(!data){
							_this.nextAll('select').hide();
							return;
						};
						// console.log(data);
						// console.log($(this).constructor);
						//填充下一级的数据
						for(var i = 0; i<data.length;i++){
							$('<option value="'+data[i].id+'">'+data[i].name+'</option>').appendTo(_this.next('select'));
						}
						//自动触发后面的select的change事件
						_this.next('select').trigger('change');
					},
					dataType:'json',
				})
			})

			//自动加载省份的change事件
			$('#pro').trigger('change');
		})
		</script>
</block>
